//
//  TheDriverCell.m
//  Logistics
//
//  Created by enzhoukeji on 2018/8/7.
//  Copyright © 2018年 puyue.com. All rights reserved.
//

#import "TheDriverCell.h"

@implementation TheDriverCell

-(void)loadViews{
    self.backgroundColor = [UIColor clearColor];
    self.bigView = [UIView new];
    self.bigView.backgroundColor = [UIColor whiteColor];
    self.bigView.layer.cornerRadius = 5;
    self.bigView.layer.masksToBounds=YES;
    self.headImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"touxiangMN"]];
    self.titleL = [UILabel labelWithSize:[UIFont systemFontOfSize:14] withColor:[UIColor blackColor] withText:@"千佛山大佛"];
     self.phoneL = [UILabel labelWithSize:[UIFont systemFontOfSize:12] withColor:[UIColor grayColor] withText:@"13054000000"];
     self.contentL = [UILabel labelWithSize:[UIFont systemFontOfSize:12] withColor:[UIColor grayColor] withText:@"哦啊死后的卡上的空间哈三等奖卡萨丁看看你那可能经常能看出看得起看qweeeee见我"];
    self.contentL.numberOfLines = 0;
    self.telBut = [UIButton new];
    [self.telBut setBackgroundImage:[UIImage imageNamed:@"gouwuche"] forState:UIControlStateNormal];
    [self.telBut addTarget:self action:@selector(telButtonC:) forControlEvents:UIControlEventTouchUpInside];

    self.confirmBut = [UIButton buttonWithTitle:@"指定该司机承运" withImageName:nil withBGColor:nil Withlayer:NO];
    self.confirmBut.backgroundColor = [UIColor colorWithRed:106/255.0 green:183/255.0 blue:234/255.0 alpha:1];
    self.confirmBut.titleLabel.font = [UIFont systemFontOfSize:13];
    [self.confirmBut addTarget:self action:@selector(confirmButtonC:) forControlEvents:UIControlEventTouchUpInside];

    
    [self addSubview:self.bigView];
    [self.bigView addSubview:self.headImage];
    [self.bigView addSubview:self.titleL];
    [self.bigView addSubview:self.phoneL];
    [self.bigView addSubview:self.contentL];
    [self.bigView addSubview:self.telBut];
    [self.bigView addSubview:self.confirmBut];
}
-(void)layoutViews{
    [self.bigView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(GTFixWidthFlaot(0)));
        make.top.equalTo(@(GTFixHeightFlaot(0)));
        make.bottom.equalTo(@(GTFixHeightFlaot(0)));
        make.right.mas_equalTo(0);
    }];
    
    [self.headImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(GTFixWidthFlaot(10)));
        make.top.equalTo(@(GTFixHeightFlaot(10)));
        make.height.equalTo(@(GTFixHeightFlaot(40)));
        make.width.equalTo(@(GTFixHeightFlaot(40)));
    }];
    [self.titleL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.headImage.mas_right).offset(GTFixWidthFlaot(5));
        make.top.equalTo(@(GTFixHeightFlaot(10)));
        make.height.equalTo(@(GTFixHeightFlaot(15)));
        make.width.equalTo(@(GTFixWidthFlaot(60)));
    }];
    [self.phoneL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.headImage.mas_right).offset(GTFixWidthFlaot(5));
        make.top.equalTo(self.titleL.mas_bottom).offset(GTFixHeightFlaot(5));
        make.height.equalTo(@(GTFixHeightFlaot(15)));
        make.width.equalTo(@(GTFixWidthFlaot(80)));
    }];
    [self.contentL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.headImage.mas_right).offset(GTFixWidthFlaot(5));
        make.top.equalTo(self.phoneL.mas_bottom).offset(GTFixHeightFlaot(2));
        make.height.equalTo(@(GTFixHeightFlaot(30)));
        make.width.mas_equalTo(self.width - GTFixWidthFlaot(65));
    }];
    [self.telBut mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(@(GTFixWidthFlaot(-10)));
        make.top.equalTo(@(GTFixHeightFlaot(10)));
        make.height.equalTo(@(GTFixHeightFlaot(30)));
        make.width.mas_equalTo(GTFixHeightFlaot(30));
    }];
    [self.confirmBut mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.bottom.equalTo(self.mas_bottom).offset(0);
        make.height.mas_equalTo(GTFixHeightFlaot(25));
        
    }];
}
-(void)setIndexPath:(NSIndexPath *)indexPath{
    _indexPath = indexPath;
}
-(void)telButtonC:(UIButton *)btn {
    if (self.delegate) {
        [self.delegate theDriverwithIndexPath:self.indexPath withtype:@"1"];
    }
}
-(void)confirmButtonC:(UIButton *)btn {
    if (self.delegate) {
        [self.delegate theDriverwithIndexPath:self.indexPath withtype:@"2"];
    }
}
@end













